<?php  
class ControllerModuleProMegaMenu extends Controller {
	protected function index() {
		$this->language->load('module/treoden_productbycategory');
		$this->data['menu'] = $this->language->get('menu');
		$this->load->model('module/pro_megamenu');
		$root_menus = $this->model_module_pro_megamenu->getlist();	

		if($root_menus){
			foreach($root_menus as $key=>$value){
				if($value['type']=='category')
					$root_menus[$key]['url'] = $this->url->link('product/category', 'path=' . $value['type_id']);
				if($value['type']=='infomation')
					$root_menus[$key]['url'] = $this->url->link('information/information', 'information_id=' . $value['type_id']);
				if($value['type']=='manufacturer')
					$root_menus[$key]['url'] = $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $value['type_id']);
			}
		}
		$this->data['menus_root'] = $root_menus;	
		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/pro_megamenu.tpl')) {
			$this->template = $this->config->get('config_template') . '/template/module/pro_megamenu.tpl';
		} else {
			$this->template = 'default/template/module/pro_megamenu.tpl';
		}
		
    	$this->render();
	}
	
}
?>